/*
 * SimpleMain.java
 *
 * Created on June 24, 2008, 7:20 PM
 */

package jwu2.gui;

import java.awt.Color;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.SwingUtilities;
import jwu2.core.Task;
import jwu2.core.TaskListener;

/**
 *
 * @author  jbk
 */
public class SimpleMain extends javax.swing.JFrame implements TaskListener {
    public static Color textBackground = new Color(183,220,224);
    public static Color inputBackground = new Color(228,246,246);

    /** Creates new form SimpleMain */
    public SimpleMain() {
        initComponents();
        
        // Add the taskTree to the taskTree panel
        taskPanel.add(new TaskTreePanel(Task.getRootTask(), null));        
        
        // Allow the main progress bar to be updated from the rootTask
        Task.getRootTask().addListener(this);
        
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        layers = new javax.swing.JLayeredPane();
        mainFront = new javax.swing.JPanel();
        headerLabel = new javax.swing.JLabel();
        buttonPanel = new javax.swing.JPanel();
        addButton = new javax.swing.JButton();
        updateButton = new javax.swing.JButton();
        removeButton = new javax.swing.JButton();
        statusPanel = new javax.swing.JLayeredPane();
        statusButtonPanel = new javax.swing.JPanel();
        mainProgressBar = new javax.swing.JProgressBar();
        moreButton = new javax.swing.JButton();
        statusButtonBackground = new javax.swing.JPanel();
        seperatorLabel = new javax.swing.JLabel();
        expansionPane = new javax.swing.JPanel();
        extensionTabs = new javax.swing.JTabbedPane();
        taskPanel = new javax.swing.JPanel();
        logPanel = new javax.swing.JPanel();
        logScrollPane = new javax.swing.JScrollPane();
        logTextArea = new javax.swing.JTextArea();
        bundlePanel = new javax.swing.JPanel();
        jScrollPane1 = new javax.swing.JScrollPane();
        jPanel1 = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jButton1 = new javax.swing.JButton();
        jButton2 = new javax.swing.JButton();
        configurationPanel = new javax.swing.JPanel();
        jScrollPane2 = new javax.swing.JScrollPane();
        jPanel2 = new javax.swing.JPanel();
        jLabel3 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jWowPath = new javax.swing.JTextField();
        jButton3 = new javax.swing.JButton();
        jNoExt = new javax.swing.JCheckBox();
        jCleanup = new javax.swing.JCheckBox();
        JSplitAddon = new javax.swing.JCheckBox();
        jDeleteFirst = new javax.swing.JCheckBox();
        jShowChangelog = new javax.swing.JCheckBox();
        jAutoEmbed = new javax.swing.JCheckBox();
        jAutoUpdate = new javax.swing.JCheckBox();
        jStripUTF8 = new javax.swing.JCheckBox();
        jLabel5 = new javax.swing.JLabel();
        jCurrentTimeout = new javax.swing.JLabel();
        jSocketTimeout = new javax.swing.JSlider();
        jSeparator1 = new javax.swing.JSeparator();
        jSeparator2 = new javax.swing.JSeparator();
        jSeparator3 = new javax.swing.JSeparator();
        jSeparator4 = new javax.swing.JSeparator();
        jLabel6 = new javax.swing.JLabel();
        jSocketTimeout1 = new javax.swing.JSlider();
        jCurrentTimeout1 = new javax.swing.JLabel();
        jSeparator5 = new javax.swing.JSeparator();
        jEnableProxy = new javax.swing.JCheckBox();
        jLabel7 = new javax.swing.JLabel();
        jProxyAddress = new javax.swing.JTextField();
        jLabel8 = new javax.swing.JLabel();
        jProxyPort = new javax.swing.JTextField();
        jProxyAuth = new javax.swing.JCheckBox();
        jLabel9 = new javax.swing.JLabel();
        jProxyUsername = new javax.swing.JTextField();
        jLabel10 = new javax.swing.JLabel();
        jProxyPassword = new javax.swing.JTextField();
        jSeparator6 = new javax.swing.JSeparator();
        jButton4 = new javax.swing.JButton();
        jButton5 = new javax.swing.JButton();
        jPanel4 = new javax.swing.JPanel();
        jPanel5 = new javax.swing.JPanel();
        aboutPanel = new javax.swing.JPanel();
        jScrollPane3 = new javax.swing.JScrollPane();
        jPanel3 = new javax.swing.JPanel();
        jLabel11 = new javax.swing.JLabel();
        backgroundLabel = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
        addComponentListener(new java.awt.event.ComponentAdapter() {
            public void componentResized(java.awt.event.ComponentEvent evt) {
                formComponentResized(evt);
            }
        });

        mainFront.setOpaque(false);

        headerLabel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/jwu2/gui/header.png"))); // NOI18N
        headerLabel.setText("jLabel2");

        buttonPanel.setOpaque(false);

        addButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/jwu2/gui/add.png"))); // NOI18N
        addButton.setText("Add ");
        addButton.setAlignmentY(0.0F);
        addButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        addButton.setVerticalAlignment(javax.swing.SwingConstants.BOTTOM);
        addButton.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        addButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                addButtonActionPerformed(evt);
            }
        });

        updateButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/jwu2/gui/update.png"))); // NOI18N
        updateButton.setText("Update");
        updateButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        updateButton.setVerticalAlignment(javax.swing.SwingConstants.BOTTOM);
        updateButton.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        updateButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                updateButtonActionPerformed(evt);
            }
        });

        removeButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/jwu2/gui/remove.png"))); // NOI18N
        removeButton.setText("Remove");
        removeButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        removeButton.setVerticalAlignment(javax.swing.SwingConstants.BOTTOM);
        removeButton.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        removeButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                removeButtonActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout buttonPanelLayout = new javax.swing.GroupLayout(buttonPanel);
        buttonPanel.setLayout(buttonPanelLayout);
        buttonPanelLayout.setHorizontalGroup(
            buttonPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(buttonPanelLayout.createSequentialGroup()
                .addComponent(updateButton, javax.swing.GroupLayout.PREFERRED_SIZE, 85, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(addButton, javax.swing.GroupLayout.PREFERRED_SIZE, 85, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(removeButton, javax.swing.GroupLayout.PREFERRED_SIZE, 85, javax.swing.GroupLayout.PREFERRED_SIZE))
        );
        buttonPanelLayout.setVerticalGroup(
            buttonPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(removeButton, javax.swing.GroupLayout.DEFAULT_SIZE, 91, Short.MAX_VALUE)
            .addComponent(addButton, javax.swing.GroupLayout.DEFAULT_SIZE, 91, Short.MAX_VALUE)
            .addComponent(updateButton, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 91, Short.MAX_VALUE)
        );

        statusPanel.addComponentListener(new java.awt.event.ComponentAdapter() {
            public void componentResized(java.awt.event.ComponentEvent evt) {
                resizeMoreButton(evt);
            }
        });

        statusButtonPanel.setOpaque(false);

        mainProgressBar.setValue(100);
        mainProgressBar.setString("Ready");
        mainProgressBar.setStringPainted(true);

        moreButton.setText("More");
        moreButton.setBorderPainted(false);

        javax.swing.GroupLayout statusButtonPanelLayout = new javax.swing.GroupLayout(statusButtonPanel);
        statusButtonPanel.setLayout(statusButtonPanelLayout);
        statusButtonPanelLayout.setHorizontalGroup(
            statusButtonPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, statusButtonPanelLayout.createSequentialGroup()
                .addComponent(mainProgressBar, javax.swing.GroupLayout.DEFAULT_SIZE, 177, Short.MAX_VALUE)
                .addGap(18, 18, 18)
                .addComponent(moreButton))
        );
        statusButtonPanelLayout.setVerticalGroup(
            statusButtonPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(moreButton, javax.swing.GroupLayout.DEFAULT_SIZE, 26, Short.MAX_VALUE)
            .addComponent(mainProgressBar, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 26, Short.MAX_VALUE)
        );

        statusButtonPanel.setBounds(0, 0, 260, 26);
        statusPanel.add(statusButtonPanel, javax.swing.JLayeredPane.DEFAULT_LAYER);

        seperatorLabel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/jwu2/gui/seperator.png"))); // NOI18N
        seperatorLabel.setText("jLabel1");
        seperatorLabel.setVerticalAlignment(javax.swing.SwingConstants.TOP);

        javax.swing.GroupLayout statusButtonBackgroundLayout = new javax.swing.GroupLayout(statusButtonBackground);
        statusButtonBackground.setLayout(statusButtonBackgroundLayout);
        statusButtonBackgroundLayout.setHorizontalGroup(
            statusButtonBackgroundLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(seperatorLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 330, Short.MAX_VALUE)
        );
        statusButtonBackgroundLayout.setVerticalGroup(
            statusButtonBackgroundLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(seperatorLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)
        );

        statusButtonBackground.setBounds(0, 0, 330, 30);
        statusPanel.add(statusButtonBackground, javax.swing.JLayeredPane.DEFAULT_LAYER);

        expansionPane.setBackground(new Color(0f,0f,0f,0.1f));

        extensionTabs.setBackground(new Color(0.9f, 0.9f, 1f, 0.5f));
        extensionTabs.setTabPlacement(javax.swing.JTabbedPane.LEFT);
        extensionTabs.setDoubleBuffered(true);
        extensionTabs.setMinimumSize(new java.awt.Dimension(26, 25));
        extensionTabs.setPreferredSize(new java.awt.Dimension(10, 10));
        extensionTabs.addChangeListener(new javax.swing.event.ChangeListener() {
            public void stateChanged(javax.swing.event.ChangeEvent evt) {
                extensionTabsStateChanged(evt);
            }
        });

        taskPanel.setBackground(textBackground);
        taskPanel.setLayout(new javax.swing.BoxLayout(taskPanel, javax.swing.BoxLayout.LINE_AXIS));
        extensionTabs.addTab("Task Display", taskPanel);

        logScrollPane.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);

        logTextArea.setColumns(20);
        logTextArea.setRows(5);
        logTextArea.setText("Addons that will be updated:\n\nAll Ace addons are Up-2-Date\n\nChecking which Non-Ace addons need updating...\n\nAll Non-Ace addons are Up-2-Date");
        logScrollPane.setViewportView(logTextArea);

        javax.swing.GroupLayout logPanelLayout = new javax.swing.GroupLayout(logPanel);
        logPanel.setLayout(logPanelLayout);
        logPanelLayout.setHorizontalGroup(
            logPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(logScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 178, Short.MAX_VALUE)
        );
        logPanelLayout.setVerticalGroup(
            logPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(logScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 165, Short.MAX_VALUE)
        );

        extensionTabs.addTab("Log", logPanel);

        jPanel1.setBackground(textBackground);

        jLabel1.setText("<html><h1>Addon Bundles</h1></html>");
        jLabel1.setVerticalAlignment(javax.swing.SwingConstants.TOP);

        jLabel2.setText("<html><p>Addon bundles are a way of easily installing a collection of addons by just pointing JWU to the bundle file describing the compilation.<br />Bundles are very useful when helping your friends and guild with addons.</p></html>");

        jButton1.setText("Install from bundle");
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });

        jButton2.setText("Create new bundle");

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, 169, Short.MAX_VALUE)
                    .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, 169, Short.MAX_VALUE)
                    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                        .addComponent(jButton1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(jButton2, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
                .addContainerGap())
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGap(0, 0, 0)
                .addComponent(jLabel1)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel2)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jButton1)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jButton2)
                .addContainerGap(42, Short.MAX_VALUE))
        );

        jScrollPane1.setViewportView(jPanel1);

        javax.swing.GroupLayout bundlePanelLayout = new javax.swing.GroupLayout(bundlePanel);
        bundlePanel.setLayout(bundlePanelLayout);
        bundlePanelLayout.setHorizontalGroup(
            bundlePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 178, Short.MAX_VALUE)
        );
        bundlePanelLayout.setVerticalGroup(
            bundlePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 165, Short.MAX_VALUE)
        );

        extensionTabs.addTab("Bundles", bundlePanel);

        jScrollPane2.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);

        jPanel2.setBackground(textBackground);

        jLabel3.setText("<html><h1>Configuration</h1></html>");

        jLabel4.setText("Path to WoW install directory:");

        jWowPath.setBackground(inputBackground);

        jButton3.setText("Browse");
        jButton3.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
        jButton3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton3ActionPerformed(evt);
            }
        });

        jNoExt.setFont(jNoExt.getFont());
        jNoExt.setText("<html>No externals<br /><font size=\"-2\"> Addons are downloaded independently of their external library dependencies (whut?!?). This usually makes loading of addons faster.</font></html>");
        jNoExt.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
        jNoExt.setMargin(new java.awt.Insets(0, 0, 0, 0));
        jNoExt.setOpaque(false);
        jNoExt.setVerticalAlignment(javax.swing.SwingConstants.TOP);
        jNoExt.setVerticalTextPosition(javax.swing.SwingConstants.TOP);
        jNoExt.addChangeListener(new javax.swing.event.ChangeListener() {
            public void stateChanged(javax.swing.event.ChangeEvent evt) {
                jNoExtStateChanged(evt);
            }
        });
        jNoExt.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jNoExtActionPerformed(evt);
            }
        });

        jCleanup.setText("<html>Clean descriptor files<br /><font size=\"-2\">Clean .toc, embeds and includes to slightly speed up loading of addons when no externals is used.</font></html>");
        jCleanup.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
        jCleanup.setEnabled(false);
        jCleanup.setMargin(new java.awt.Insets(0, 0, 0, 0));
        jCleanup.setOpaque(false);
        jCleanup.setVerticalAlignment(javax.swing.SwingConstants.TOP);
        jCleanup.setVerticalTextPosition(javax.swing.SwingConstants.TOP);
        jCleanup.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jCleanupActionPerformed(evt);
            }
        });

        JSplitAddon.setText("<html>Use on-demand loading<br /><font size=\"-2\">Addons with filelist.au present will be split so that subaddons can be loaded on-demand instead of all at once. This speeds up the login process.</font></html>");
        JSplitAddon.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
        JSplitAddon.setMargin(new java.awt.Insets(0, 0, 0, 0));
        JSplitAddon.setOpaque(false);
        JSplitAddon.setVerticalAlignment(javax.swing.SwingConstants.TOP);
        JSplitAddon.setVerticalTextPosition(javax.swing.SwingConstants.TOP);

        jDeleteFirst.setText("<html>Clean folders before updating<br /><font size=\"-2\">Addon directories are deleted before the new addon version is installed. This ensures that no trash is left over.</font></html>");
        jDeleteFirst.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
        jDeleteFirst.setMargin(new java.awt.Insets(0, 0, 0, 0));
        jDeleteFirst.setOpaque(false);
        jDeleteFirst.setVerticalAlignment(javax.swing.SwingConstants.TOP);
        jDeleteFirst.setVerticalTextPosition(javax.swing.SwingConstants.TOP);

        jShowChangelog.setText("<html>Show changelogs<br /><font size=\"-2\">This will show changes in the updated addons (if the information is available from the publisher).</font></html>");
        jShowChangelog.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
        jShowChangelog.setMargin(new java.awt.Insets(0, 0, 0, 0));
        jShowChangelog.setOpaque(false);
        jShowChangelog.setVerticalAlignment(javax.swing.SwingConstants.TOP);
        jShowChangelog.setVerticalTextPosition(javax.swing.SwingConstants.TOP);
        jShowChangelog.addChangeListener(new javax.swing.event.ChangeListener() {
            public void stateChanged(javax.swing.event.ChangeEvent evt) {
                jShowChangelogStateChanged(evt);
            }
        });

        jAutoEmbed.setText("<html>Automatically handle dependencies<br /><font size=\"-2\">Determine interdependencies and automatically download and update these. Also removes unused depedency addons (unless they are whitelisted).</font></html>");
        jAutoEmbed.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
        jAutoEmbed.setMargin(new java.awt.Insets(0, 0, 0, 0));
        jAutoEmbed.setOpaque(false);
        jAutoEmbed.setVerticalAlignment(javax.swing.SwingConstants.TOP);
        jAutoEmbed.setVerticalTextPosition(javax.swing.SwingConstants.TOP);

        jAutoUpdate.setText("<html>Update jWowUpdater<br /><font size=\"-2\">Automatically download new versions of the updater when they become available.</font></html>");
        jAutoUpdate.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
        jAutoUpdate.setMargin(new java.awt.Insets(0, 0, 0, 0));
        jAutoUpdate.setOpaque(false);
        jAutoUpdate.setVerticalAlignment(javax.swing.SwingConstants.TOP);
        jAutoUpdate.setVerticalTextPosition(javax.swing.SwingConstants.TOP);

        jStripUTF8.setText("<html>Strip .toc UTF-8 headers<br /><font size=\"-2\">By enabling this Linux/WINE users can work around a bug in some versions of WINE causing random addons to appear incompatible.</font></html>");
        jStripUTF8.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
        jStripUTF8.setMargin(new java.awt.Insets(0, 0, 0, 0));
        jStripUTF8.setOpaque(false);
        jStripUTF8.setVerticalAlignment(javax.swing.SwingConstants.TOP);
        jStripUTF8.setVerticalTextPosition(javax.swing.SwingConstants.TOP);

        jLabel5.setText("<html>Socket timeout<br /><font size=\"-2\">How long to wait (in seconds) before giving up on contacting the addon servers</font></html>");

        jCurrentTimeout.setText("CURRENT");

        jSocketTimeout.setMaximum(30);
        jSocketTimeout.setPaintLabels(true);
        jSocketTimeout.setValue(14);
        jSocketTimeout.setOpaque(false);
        jSocketTimeout.addChangeListener(new javax.swing.event.ChangeListener() {
            public void stateChanged(javax.swing.event.ChangeEvent evt) {
                jSocketTimeoutStateChanged(evt);
            }
        });

        jLabel6.setText("<html>Index update interval<br /><font size=\"-2\">How often (in minutes) should the  updater check for new addons when running in continous update mode. This setting also affects how often new addons are detected for use in the \"add addons\" dialogs.</font></html>");

        jSocketTimeout1.setMaximum(30);
        jSocketTimeout1.setPaintLabels(true);
        jSocketTimeout1.setValue(7);
        jSocketTimeout1.setOpaque(false);
        jSocketTimeout1.addChangeListener(new javax.swing.event.ChangeListener() {
            public void stateChanged(javax.swing.event.ChangeEvent evt) {
                jSocketTimeout1StateChanged(evt);
            }
        });

        jCurrentTimeout1.setText("CURRENT");

        jEnableProxy.setText("<html>Enable proxy<br /><font size=\"-2\">If you connect to the internet through a proxy you can specify the connection settings here</font></html>");
        jEnableProxy.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
        jEnableProxy.setMargin(new java.awt.Insets(0, 0, 0, 0));
        jEnableProxy.setOpaque(false);
        jEnableProxy.setVerticalAlignment(javax.swing.SwingConstants.TOP);
        jEnableProxy.setVerticalTextPosition(javax.swing.SwingConstants.TOP);
        jEnableProxy.addChangeListener(new javax.swing.event.ChangeListener() {
            public void stateChanged(javax.swing.event.ChangeEvent evt) {
                jEnableProxyStateChanged(evt);
            }
        });

        jLabel7.setText("Proxy:");

        jProxyAddress.setBackground(inputBackground);

        jLabel8.setText("Port:");

        jProxyPort.setBackground(inputBackground);

        jProxyAuth.setText("Proxy needs authentication");
        jProxyAuth.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
        jProxyAuth.setMargin(new java.awt.Insets(0, 0, 0, 0));
        jProxyAuth.setOpaque(false);

        jLabel9.setText("Username:");

        jProxyUsername.setBackground(inputBackground);

        jLabel10.setText("Password:");

        jProxyPassword.setBackground(inputBackground);

        jButton4.setText("Save Config");
        jButton4.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
        jButton4.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton4ActionPerformed(evt);
            }
        });

        jButton5.setText("Cancel");
        jButton5.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
        jButton5.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton5ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addGap(17, 17, 17)
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel2Layout.createSequentialGroup()
                                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jLabel7)
                                    .addComponent(jLabel8))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                    .addComponent(jProxyPort)
                                    .addComponent(jProxyAddress, javax.swing.GroupLayout.PREFERRED_SIZE, 152, javax.swing.GroupLayout.PREFERRED_SIZE)))
                            .addComponent(jProxyAuth)
                            .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel2Layout.createSequentialGroup()
                                    .addComponent(jLabel10)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(jProxyPassword))
                                .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel2Layout.createSequentialGroup()
                                    .addComponent(jLabel9)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(jProxyUsername, javax.swing.GroupLayout.PREFERRED_SIZE, 93, javax.swing.GroupLayout.PREFERRED_SIZE))))
                        .addContainerGap())
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addGap(17, 17, 17)
                        .addComponent(jCleanup, javax.swing.GroupLayout.DEFAULT_SIZE, 253, Short.MAX_VALUE)
                        .addContainerGap())
                    .addComponent(jLabel3, javax.swing.GroupLayout.DEFAULT_SIZE, 282, Short.MAX_VALUE)
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(jLabel4, javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel2Layout.createSequentialGroup()
                                .addComponent(jWowPath, javax.swing.GroupLayout.DEFAULT_SIZE, 212, Short.MAX_VALUE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jButton3)))
                        .addContainerGap())
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 130, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addContainerGap())
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(jNoExt, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 270, Short.MAX_VALUE)
                            .addComponent(jAutoEmbed, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 270, Short.MAX_VALUE)
                            .addComponent(jDeleteFirst, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 270, Short.MAX_VALUE)
                            .addComponent(JSplitAddon, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 270, Short.MAX_VALUE)
                            .addComponent(jSeparator2, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 270, Short.MAX_VALUE)
                            .addComponent(jShowChangelog, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 270, Short.MAX_VALUE)
                            .addComponent(jAutoUpdate, javax.swing.GroupLayout.DEFAULT_SIZE, 270, Short.MAX_VALUE))
                        .addContainerGap())
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addComponent(jSocketTimeout, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jCurrentTimeout)
                        .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addComponent(jSocketTimeout1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jCurrentTimeout1)
                        .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(jSeparator6, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 270, Short.MAX_VALUE)
                            .addComponent(jEnableProxy, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 270, Short.MAX_VALUE)
                            .addComponent(jSeparator5, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 270, Short.MAX_VALUE)
                            .addComponent(jLabel6, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 270, Short.MAX_VALUE)
                            .addComponent(jLabel5, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 270, Short.MAX_VALUE)
                            .addComponent(jSeparator4, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 270, Short.MAX_VALUE)
                            .addComponent(jStripUTF8, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 270, Short.MAX_VALUE)
                            .addComponent(jSeparator3, javax.swing.GroupLayout.DEFAULT_SIZE, 270, Short.MAX_VALUE))
                        .addContainerGap())
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addComponent(jButton4)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jButton5)
                        .addContainerGap(143, Short.MAX_VALUE))))
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addComponent(jLabel3)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel4)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jWowPath, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jButton3))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jAutoUpdate)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jShowChangelog)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jSeparator2, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(JSplitAddon)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jDeleteFirst)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jAutoEmbed)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jNoExt)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jCleanup)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jSeparator3, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jStripUTF8)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jSeparator4, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel5)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jSocketTimeout, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jCurrentTimeout))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jLabel6)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jSocketTimeout1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jCurrentTimeout1))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jSeparator5, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jEnableProxy)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel7)
                    .addComponent(jProxyAddress, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel8)
                    .addComponent(jProxyPort, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jProxyAuth)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel9)
                    .addComponent(jProxyUsername, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel10)
                    .addComponent(jProxyPassword, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jSeparator6, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jButton4)
                    .addComponent(jButton5))
                .addContainerGap(51, Short.MAX_VALUE))
        );

        jScrollPane2.setViewportView(jPanel2);

        javax.swing.GroupLayout configurationPanelLayout = new javax.swing.GroupLayout(configurationPanel);
        configurationPanel.setLayout(configurationPanelLayout);
        configurationPanelLayout.setHorizontalGroup(
            configurationPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 178, Short.MAX_VALUE)
        );
        configurationPanelLayout.setVerticalGroup(
            configurationPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 165, Short.MAX_VALUE)
        );

        extensionTabs.addTab("Configuration", configurationPanel);

        javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
        jPanel4.setLayout(jPanel4Layout);
        jPanel4Layout.setHorizontalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 178, Short.MAX_VALUE)
        );
        jPanel4Layout.setVerticalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 165, Short.MAX_VALUE)
        );

        extensionTabs.addTab("Blacklist", jPanel4);

        javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5);
        jPanel5.setLayout(jPanel5Layout);
        jPanel5Layout.setHorizontalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 178, Short.MAX_VALUE)
        );
        jPanel5Layout.setVerticalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 165, Short.MAX_VALUE)
        );

        extensionTabs.addTab("Whitelist", jPanel5);

        aboutPanel.setBackground(textBackground);

        jPanel3.setBackground(textBackground);

        jLabel11.setBackground(textBackground);
        jLabel11.setText("<html><body><h1>About</h1>\n<p>jWowUpdater version 2 is a work by Rolf Bagge and Janus Kristensen</p>\n<p><i>It's the #1 addon upd8er that r0x0rz ur b0xorz b4 ne1 else m8!</i></p>\n<p>Code available as GPLv2</p></html>");
        jLabel11.setVerticalAlignment(javax.swing.SwingConstants.TOP);
        jLabel11.setMinimumSize(new java.awt.Dimension(50, 50));

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 175, Short.MAX_VALUE)
            .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel3Layout.createSequentialGroup()
                    .addContainerGap()
                    .addComponent(jLabel11, javax.swing.GroupLayout.DEFAULT_SIZE, 163, Short.MAX_VALUE)))
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 162, Short.MAX_VALUE)
            .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel3Layout.createSequentialGroup()
                    .addGap(7, 7, 7)
                    .addComponent(jLabel11, javax.swing.GroupLayout.DEFAULT_SIZE, 155, Short.MAX_VALUE)))
        );

        jScrollPane3.setViewportView(jPanel3);

        javax.swing.GroupLayout aboutPanelLayout = new javax.swing.GroupLayout(aboutPanel);
        aboutPanel.setLayout(aboutPanelLayout);
        aboutPanelLayout.setHorizontalGroup(
            aboutPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jScrollPane3, javax.swing.GroupLayout.DEFAULT_SIZE, 178, Short.MAX_VALUE)
        );
        aboutPanelLayout.setVerticalGroup(
            aboutPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jScrollPane3, javax.swing.GroupLayout.DEFAULT_SIZE, 165, Short.MAX_VALUE)
        );

        extensionTabs.addTab("About", aboutPanel);

        javax.swing.GroupLayout expansionPaneLayout = new javax.swing.GroupLayout(expansionPane);
        expansionPane.setLayout(expansionPaneLayout);
        expansionPaneLayout.setHorizontalGroup(
            expansionPaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 317, Short.MAX_VALUE)
            .addGroup(expansionPaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(expansionPaneLayout.createSequentialGroup()
                    .addContainerGap()
                    .addComponent(extensionTabs, javax.swing.GroupLayout.DEFAULT_SIZE, 293, Short.MAX_VALUE)
                    .addContainerGap()))
        );
        expansionPaneLayout.setVerticalGroup(
            expansionPaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 196, Short.MAX_VALUE)
            .addGroup(expansionPaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(expansionPaneLayout.createSequentialGroup()
                    .addContainerGap()
                    .addComponent(extensionTabs, javax.swing.GroupLayout.DEFAULT_SIZE, 172, Short.MAX_VALUE)
                    .addContainerGap()))
        );

        javax.swing.GroupLayout mainFrontLayout = new javax.swing.GroupLayout(mainFront);
        mainFront.setLayout(mainFrontLayout);
        mainFrontLayout.setHorizontalGroup(
            mainFrontLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(mainFrontLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(buttonPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(26, Short.MAX_VALUE))
            .addComponent(headerLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 317, Short.MAX_VALUE)
            .addComponent(statusPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 317, Short.MAX_VALUE)
            .addComponent(expansionPane, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        mainFrontLayout.setVerticalGroup(
            mainFrontLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(mainFrontLayout.createSequentialGroup()
                .addComponent(headerLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 44, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(buttonPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(statusPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(expansionPane, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        mainFront.setBounds(0, 0, -1, -1);
        layers.add(mainFront, javax.swing.JLayeredPane.DEFAULT_LAYER);

        backgroundLabel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/jwu2/gui/background.png"))); // NOI18N
        backgroundLabel.setVerticalAlignment(javax.swing.SwingConstants.TOP);
        backgroundLabel.setAlignmentY(0.0F);
        backgroundLabel.setBounds(0, 0, -1, -1);
        layers.add(backgroundLabel, javax.swing.JLayeredPane.DEFAULT_LAYER);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(layers, javax.swing.GroupLayout.DEFAULT_SIZE, 338, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(layers, javax.swing.GroupLayout.DEFAULT_SIZE, 178, Short.MAX_VALUE)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

private void removeButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_removeButtonActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_removeButtonActionPerformed

private void updateButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_updateButtonActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_updateButtonActionPerformed

private void resizeMoreButton(java.awt.event.ComponentEvent evt) {//GEN-FIRST:event_resizeMoreButton
    int xPos = evt.getComponent().getWidth();
    int yPos = statusButtonPanel.getHeight();
    statusButtonPanel.setSize(xPos, yPos);
    yPos = statusButtonBackground.getHeight();
    statusButtonBackground.setSize(xPos, yPos);
    statusPanel.validate();
}//GEN-LAST:event_resizeMoreButton

private void addButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addButtonActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_addButtonActionPerformed

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_jButton1ActionPerformed

private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
//Show browser
        /*JFileChooser fileBrowser = new JFileChooser();
        fileBrowser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
        fileBrowser.setFileHidingEnabled(false);
        fileBrowser.setMultiSelectionEnabled(false);
        int value = fileBrowser.showDialog(null, "Select");
        if(value == JFileChooser.APPROVE_OPTION) {
            jWowPath.setText(fileBrowser.getSelectedFile().getPath());
        }*/
}//GEN-LAST:event_jButton3ActionPerformed

private void jNoExtStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_jNoExtStateChanged
if (jNoExt.isSelected()){
            jCleanup.setEnabled(true);
        } else {
            jCleanup.setEnabled(false);
        }
}//GEN-LAST:event_jNoExtStateChanged

private void jShowChangelogStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_jShowChangelogStateChanged

}//GEN-LAST:event_jShowChangelogStateChanged

private void jSocketTimeoutStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_jSocketTimeoutStateChanged
jCurrentTimeout.setText(""+jSocketTimeout.getValue());
}//GEN-LAST:event_jSocketTimeoutStateChanged

private void jNoExtActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jNoExtActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_jNoExtActionPerformed

private void jCleanupActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jCleanupActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_jCleanupActionPerformed

private void jSocketTimeout1StateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_jSocketTimeout1StateChanged
// TODO add your handling code here:
}//GEN-LAST:event_jSocketTimeout1StateChanged

private void jEnableProxyStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_jEnableProxyStateChanged
jProxyAddress.setEnabled(jEnableProxy.isSelected());
jProxyPort.setEnabled(jEnableProxy.isSelected());
}//GEN-LAST:event_jEnableProxyStateChanged

private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton4ActionPerformed
/*conf.setNoExt(jNoExt.isSelected());
        conf.setWowPath(jWowPath.getText());
        conf.setProxyEnabled(jEnableProxy.isSelected() );
        
        try{
            int port = Integer.parseInt(jProxyPort.getText());
            conf.setProxyPort( port );
        }
        catch(NumberFormatException e) {
            //Numberformat exception
            JOptionPane.showMessageDialog(null, "Proxy port number must be an integer", "Port Error", JOptionPane.ERROR_MESSAGE);
            return;
        }
        
        conf.setProxy(jProxyAddress.getText());
        
        conf.setDeleteFirst(jDeleteFirst.isSelected());
        
        conf.setSplitAddon(JSplitAddon.isSelected());
        
        conf.setLibUpdates(jLibUpdate.isSelected());
        
        conf.setCleanup(jCleanup.isSelected());
        
        conf.setProxyAuth(jProxyAuth.isSelected());
        
        conf.setProxyUser(jProxyUsername.getText());
        
        conf.setProxyPass(jProxyPassword.getText());
        
        conf.setPopupChangelog(jShowChangelog.isSelected());
        
        conf.setAutoUpdate(jAutoUpdate.isSelected());
        
        conf.setTimeout(jSocketTimeout.getValue());
        
        conf.setAutomaticEmbeds(jAutoEmbed.isSelected());
        
        conf.setStripUTF8(jStripUTF8.isSelected());

        conf.setShouldShowLibs(jShowLibsOnDelete.isSelected());
        
        conf.setCacheTimeOut(convertToMillis(jCacheTimeoutSlider.getValue()));
*/        
}//GEN-LAST:event_jButton4ActionPerformed

private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton5ActionPerformed
this.setVisible(false);
        this.dispose();
}//GEN-LAST:event_jButton5ActionPerformed

private void extensionTabsStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_extensionTabsStateChanged
            layers.repaint();
}//GEN-LAST:event_extensionTabsStateChanged

private void formComponentResized(java.awt.event.ComponentEvent evt) {//GEN-FIRST:event_formComponentResized
                    mainFront.setSize(layers.getSize());
                    backgroundLabel.setSize(layers.getSize());
                    mainFront.validate();
                    backgroundLabel.validate();
                    statusPanel.validate();
                    layers.repaint();

}//GEN-LAST:event_formComponentResized

    /**
    * @param args the command line arguments
    */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new SimpleMain().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JCheckBox JSplitAddon;
    private javax.swing.JPanel aboutPanel;
    private javax.swing.JButton addButton;
    private javax.swing.JLabel backgroundLabel;
    private javax.swing.JPanel bundlePanel;
    private javax.swing.JPanel buttonPanel;
    private javax.swing.JPanel configurationPanel;
    private javax.swing.JPanel expansionPane;
    private javax.swing.JTabbedPane extensionTabs;
    private javax.swing.JLabel headerLabel;
    private javax.swing.JCheckBox jAutoEmbed;
    private javax.swing.JCheckBox jAutoUpdate;
    private javax.swing.JButton jButton1;
    private javax.swing.JButton jButton2;
    private javax.swing.JButton jButton3;
    private javax.swing.JButton jButton4;
    private javax.swing.JButton jButton5;
    private javax.swing.JCheckBox jCleanup;
    private javax.swing.JLabel jCurrentTimeout;
    private javax.swing.JLabel jCurrentTimeout1;
    private javax.swing.JCheckBox jDeleteFirst;
    private javax.swing.JCheckBox jEnableProxy;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JCheckBox jNoExt;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JPanel jPanel5;
    private javax.swing.JTextField jProxyAddress;
    private javax.swing.JCheckBox jProxyAuth;
    private javax.swing.JTextField jProxyPassword;
    private javax.swing.JTextField jProxyPort;
    private javax.swing.JTextField jProxyUsername;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JScrollPane jScrollPane3;
    private javax.swing.JSeparator jSeparator1;
    private javax.swing.JSeparator jSeparator2;
    private javax.swing.JSeparator jSeparator3;
    private javax.swing.JSeparator jSeparator4;
    private javax.swing.JSeparator jSeparator5;
    private javax.swing.JSeparator jSeparator6;
    private javax.swing.JCheckBox jShowChangelog;
    private javax.swing.JSlider jSocketTimeout;
    private javax.swing.JSlider jSocketTimeout1;
    private javax.swing.JCheckBox jStripUTF8;
    private javax.swing.JTextField jWowPath;
    private javax.swing.JLayeredPane layers;
    private javax.swing.JPanel logPanel;
    private javax.swing.JScrollPane logScrollPane;
    private javax.swing.JTextArea logTextArea;
    private javax.swing.JPanel mainFront;
    private javax.swing.JProgressBar mainProgressBar;
    private javax.swing.JButton moreButton;
    private javax.swing.JButton removeButton;
    private javax.swing.JLabel seperatorLabel;
    private javax.swing.JPanel statusButtonBackground;
    private javax.swing.JPanel statusButtonPanel;
    private javax.swing.JLayeredPane statusPanel;
    private javax.swing.JPanel taskPanel;
    private javax.swing.JButton updateButton;
    // End of variables declaration//GEN-END:variables

    public void onCompletion(Task task) {
        throw new UnsupportedOperationException("The root task should not be able to complete, this is weird!");
    }

    public void onNewSubTask(Task task, Task subTask) {
        // Forward to progress updater
        onProgressUpdate(task, subTask);
    }

    public void onProgressUpdate(Task task, Task origin) {
        // Update the progress bar
        Task recentTask = task.getMostRecentlyProgressedTask();
        int progress = (int)(task.getProgress()*(float)100);
        mainProgressBar.setValue(progress);
        String moreText = "";
        
        if (recentTask!=null){
            moreText = recentTask.getName();
            recentTask = recentTask.getMostRecentlyProgressedTask();
            if (recentTask!=null){
                moreText += " - "+recentTask.getName() + recentTask.getInfoText();
            }
        }
        mainProgressBar.setString(progress+"% "+moreText);        
    }

    public void onInactive(Task task) {
        mainProgressBar.setString("Ready");
        mainProgressBar.setValue(100);
    }

    public void onLog(Task task, String logMessage) {
        // Do nothing
    }

}
